function getid (id) {
    return document.getElementById(id);
}
function gettn (tn) {
    return document.getElementsByTagName(tn);
}
var hismax = document.getElementsByClassName("history-max")[0];
var hismin = document.getElementsByClassName("history-min")[0];
var hisem = hismin.getElementsByTagName("em")[0];
hismin.onclick = function () {
    if (hismax.style.width == 0+'px') {
        hismax.style.width = 1044+'px';
        hisem.style.backgroundPosition = (-1153)+'px '+(-115)+'px';
    }
    else {
        hismax.style.width = 0+'px';
        hisem.style.backgroundPosition = (-1167)+'px '+(-115)+'px';
    }
}




var _boxcen = getid("box-cen");
var _d = getid("d");
var _ds = _d.getElementsByTagName("span");
q = 0;
var timer = setInterval(function () { 
    if  (q == 5||q == 6) {q = 0;}
    aaa(q);
    bbb(q);  
}
,2000)
function aaa (m) {
    _boxcen.style.left = (-m*340)+'px';
    q++;
}
function bbb (m) {
    for (var i = 0;i<_ds.length;i++) {
        _ds[i].className = "";
    }
    _ds[m-1].className = "active";
}
for (var i = 0;i<_ds.length;i++) {
    (function (i) {
        _ds[i].onclick = function () {
            for (var j = 0;j<_ds.length;j++) {
                _ds[j].className = "";
            } 
            _ds[i].className = "active";
            q = i;
            aaa (q);
        }
    }(i))
}

var _headover = getid("head-over");
var _headoverlis = _headover.getElementsByTagName("li");
var _headb = getid("head-b");
var _headbul = getid("head-bul");
var _headbuls = _headbul.getElementsByTagName("ul");
_headover.onmouseover = function () {
    _headb.style.display = "block";
}
_headover.onmouseout = function () {
    _headb.style.display = "none";
}
_headb.onmouseover = function () {
    _headb.style.display = "block";
}
_headb.onmouseout = function () {
    _headb.style.display = "none";
}
for (var i = 0;i < _headbuls.length;i++) {
    (function (i) {
        _headbuls[i].onmouseover = function () {
            _headoverlis[i].getElementsByTagName("a")[0].style.color = "red !important";
        }
    }(i))
}
    

        var rtr = document.getElementsByClassName("rtr")[0]
        var lis = rtr.getElementsByTagName("li")
        var tab_ = document.getElementsByClassName("dis")
        var icon_ = rtr.getElementsByTagName("span")

        for (var i = 0; i < lis.length; i++) {
            (function (j) {
                lis[j].onmouseover = function () {
                   for (var k = 0; k <tab_.length; k++) {
                    tab_[k].style.display = "none";
                   
                       lis[k].className = " ";
                   }
                   
                   tab_[j].style.display = "block";
                   lis[j].className ="active";
                }
            }(i))
           
        }


        var hot_ = document.getElementsByClassName("hot")[0];
        var lis_ = hot_.getElementsByTagName("li");
        var tb = document.getElementsByClassName("tb");
        var _icon = hot_.getElementsByTagName("span");

        for (var i = 0; i < lis_.length; i++) {
            (function (j) {
                lis_[j].onclick = function () {
                   for (var k = 0; k <tb.length; k++) {
                    tb[k].style.display = "none";
                    lis_[k].className = " ";
                    lis_[k].getElementsByTagName("a")[0].style.color = "#555";
                   }
                   
                   tb[j].style.display = "block";
                   lis_[j].className ="active";
                   lis_[j].getElementsByTagName("a")[0].style.color = "red";
                }
            }(i))         
        }


        function getcn (cn) {
            return document.getElementsByClassName(cn)[0];
        }
        var lap = getcn("laypage_prev");
        var lan = getcn("laypage_next");
        var pp = 0;
        var tj = document.getElementsByClassName("tj")[0];
        var li_ = tj.getElementsByTagName("li");
        var _icon = tj.getElementsByTagName("span");
        var _worklist = document.getElementsByClassName("works-list")[0];
        var _wluls = _worklist.getElementsByTagName("ul");
        

        for (var i = 0; i < li_.length; i++) {
            (function (j) {
                li_[j].onclick = function () {
                   for (var k = 0; k <li_.length; k++) {
                    li_[k].className = " ";
                    li_[k].getElementsByTagName("a")[0].style.color = "#555";
                   _wluls[k].style.display = "none";
                }
                   li_[j].className ="active";
                   li_[j].getElementsByTagName("a")[0].style.color = "red";
                   _wluls[j].style.display = "block";
                }
            }(i))
        }
        
        lap.onclick = function () {
            if (pp > 0) {
                for (var k = 0; k <li_.length; k++) {
                _wluls[k].style.display = "none";
             }
             --pp;
             _wluls[pp].style.display = "block";
            }  
        }
        lan.onclick = function () {
            if (pp < li_.length-1) {
                 for (var k = 0; k <li_.length; k++) {
               _wluls[k].style.display = "none";
            }
            ++pp;
            _wluls[pp].style.display = "block";
            }
           
        }




        var djc = document.getElementsByClassName("shop-hd")[0]
        var dian = djc.getElementsByTagName("li")
        var shop_ = document.getElementsByClassName("shop")
        var _icon = djc.getElementsByTagName("span")

        for (var i = 0; i < dian.length; i++) {
            (function (j) {
                dian[j].onmousemove = function () {
                   for (var k = 0; k <shop_.length; k++) {
                    shop_[k].style.display = "none";
                    dian[k].className = " "
                   }
                   
                   shop_[j].style.display = "block";
                   dian[j].className ="op";
                }
            }(i))
           
        }


        var tit_ = document.getElementsByClassName("menu-guide-tit")[0]
        var tit_li = tit_.getElementsByTagName("li")
        var ns = document.getElementsByClassName("ns")
        var icon_ = rtr.getElementsByTagName("span")

        for (var i = 0; i < tit_li.length; i++) {
            (function (j) {
                tit_li[j].onmouseover = function () {
                   for (var k = 0; k <ns.length; k++) {
                    ns[k].style.display = "none";
                   }
                   
                   ns[j].style.display = "block";
                }
            }(i))         
        }
        for (var i = 0; i < tit_li.length; i++) {
            (function (j) {
                ns[j].onmouseover = function () {
                   for (var k = 0; k <ns.length; k++) {
                    ns[k].style.display = "none";
                   }
                   
                   ns[j].style.display = "block";
                }
            }(i))         
        }
        for (var i = 0; i < tit_li.length; i++) {
            (function (j) {
                ns[j].onmouseout = function () {
                   for (var k = 0; k <ns.length; k++) {
                    ns[k].style.display = "none";
                   }
                }
            }(i))         
        }
        tit_.onmouseout = function () {
            for (var k = 0; k <ns.length; k++) {
                ns[k].style.display = "none";
               }
        }
        